<template>
	<!-- 合伙人审核 签约门店待审核 -->
	<view class="wp">
		<view class="p_head">
			<!-- <swiper v-if="false" class="shop_info_swiper" :circular="true" :autoplay="true" :interval="5000"
				:duration="1000">
				<swiper-item v-for="item in 30">
					<view class="shop_info">
						<view class="list_li">
							<text class="name">申请门店：锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈锅圈</text>
							<text class="label">休闲娱乐</text>
						</view>
						<view class="list_li">
							<text>连锁店：是</text>
						</view>
						<view class="list_li">
							<text>单日营业额：3500元</text>
							<view @click="openAddres({x:89.00,y:89.00})">
								<text class="iconfont icon-dizhi"></text>
								<text>门店位置</text>
							</view>
						</view>
						<view class="list_li">
							<text>联系人：郭小鹏</text>
						</view>
						<view class="list_li list_li1">
							<text>电话：<text class="text_line" @click="phoneCall('1378956585458')">1378956585458</text>
							</text>
							<text class="text_line"
								@click="preImage('http://i.jiujiubaopin.com/images/9/2023/04/Gu10pqXXU70bX9dzpOPz19C9V0ZEQ7.png')">门店图片</text>
							<text class="receive">接收门店</text>
						</view>
					</view>
				</swiper-item>
			</swiper> -->

			<view class="nav_bar">
				<text :class="{'active':navIdx===1}" @click="navTap(1)">待审核({{headInfo.waitcheck}})</text>
				<text :class="{'active':navIdx===2}" @click="navTap(2)">待审批({{headInfo.waitagree}})</text>
				<text :class="{'active':navIdx===3}" @click="navTap(3)">已通过({{headInfo.agree}})</text>
				<text :class="{'active':navIdx===4}" @click="navTap(4)">已驳回({{headInfo.noagree}})</text>
			</view>
		</view>


		<view class="p_body" style="padding-top: 90upx;">
			<view class="list_item" v-for="(item,idx) in list" :key="item.uid">
				<view class="title">
					<text class="name">{{item.supname}}</text>
					<!-- <text class="name" v-if="item.paymode==1">{{item.supname}}(折扣店)</text> -->
					<!-- <text class="name" v-if="item.paymode==0">{{item.supname}}(充值店)</text> -->
					<text class="label">{{item.name}}</text>
				</view>
				<view class="list_li">
					<view class="left">
						<!-- <text>【连锁店】</text> -->
						<!-- <text>{{item.ischain}}</text> -->
					</view>
					<view class="color_1" @click="preImage(item.logo)">门店图片 ></view>
				</view>
				<view class="list_li">
					<view class="l_left">
						<!-- <view class="left">
							<text>【预估单日营收】</text>
							<text>{{item.daysale}}</text>
						</view> -->
						<view>
							<text>【老板】</text>
							<text>{{item.principalname}}</text>
							<text @click="phoneCall(item.principalmobile)">{{item.principalmobile}}</text>
						</view>
						<view>
							<text>【推店人】</text>
							<text>{{item.saleman}}</text>
							<text @click="phoneCall(item.mobile)">{{item.mobile}}</text>
						</view>
					</view>
					<!-- <view class="color_1" @click="openAddres(item)">门店位置 ></view> -->
				</view>
				<view class="list_li">
					<view class="left">
						<text>【申请日期】</text>
						<text>{{item.createtime}}</text>
					</view>
					<!-- <view class="color_1" @click="phoneCall(item.principalmobile)">拨打电话 ></view> -->
				</view>
				<view class="list_li" v-if="navIdx===3&&item.examinetime">
					<view class="left">
						<text>【审核日期】</text>
						<text>{{item.examinetime}}</text>
					</view>
				</view>
				<view class="warn">
					通过审核后，门店可上线展示；驳回后，门店无法展示。
				</view>
				<!-- <view class="buttons" v-if="navIdx==1">
					<button class="button_1" size="mini" @click="submitTap(item,-1,idx)">驳回申请</button>
					<button class="button_2" size="mini" @click="submitTap(item,1,idx)">通过审核</button>
					<button class="button_3" size="mini" @click="$navTo('/pages/shoplist/shopgoods?id='+item.uid)">查看店铺</button>
					<button class="button_4" size="mini" @click="$navTo('/pages/business/merch?uid='+item.uid)">查看信息</button>
				</view>
				<view class="buttons" v-if="navIdx===2">
						<button class="button_1" size="mini" v-if="item.status==1 && item.checkstatus==0" @click="submitTap2(item,-1,idx)">驳回申请</button>
						<button class="button_2" size="mini" v-if="item.status==1 && item.checkstatus==0 || (item.status== 1 && item.checkstatus== -1 )" @click="submitTap2(item,1,idx)">通过审核</button>
						<button class="button_3" size="mini" @click="$navTo('/pages/shoplist/shopgoods?id='+item.uid)">查看店铺</button>
						<button class="button_4" size="mini" @click="$navTo('/pages/business/merch?uid='+item.uid)">查看信息</button>
				</view>
				<view class="buttons" v-if="navIdx==4">
					<button class="button_2" size="mini" v-if="item.status==0 && item.checkstatus==0 || (item.status== -1 && item.checkstatus== 0 )" @click="submitTap(item,1,idx)">通过审核</button>
					<button class="button_1" size="mini" v-if="item.status==1 && item.checkstatus==0" @click="submitTap2(item,-1,idx)">驳回申请</button>
					<button class="button_2" size="mini" v-if="item.status==1 && item.checkstatus==0 || (item.status== 1 && item.checkstatus== -1 )" @click="submitTap2(item,1,idx)">通过审核</button>
					<button class="button_3" size="mini" @click="$navTo('/pages/shoplist/shopgoods?id='+item.uid)">查看店铺</button>
					<button class="button_4" size="mini" @click="$navTo('/pages/business/merch?uid='+item.uid)">查看信息</button>
				</view> -->
				
			</view>
			<view class="empty">
				<image v-if="isloading" src="../../static/business/loading.gif" mode=""></image>
				<text v-if="!ismore">到底了~</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				navIdx: 1,
				headInfo: {
					agree: 0,
					noagree: 0,
					waitagree: 0,
					waitcheck: 0,
				},
				page: 0,
				list: [],
				isloading: false,
				ismore: true,
			}
		},
		onLoad() {
			this.getHeadInfo();
			this.getList();
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			getHeadInfo() {
				this.$axios('supplier/main', 'POST', 'member').then(res => {
					if (res.data.code == 200) {
						this.headInfo = res.data.data;
					}
				})
			},
			getList() {
				this.page++;
				this.isloading = true;
				this.ismore = true;
				this.$axios('supplier/lists', 'POST', 'member', {
					page: this.page,
					type: this.navIdx
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						this.list = [...this.list, ...res.data.data];
						this.ismore = res.data.data.length > 0;
					}
				})
			},
			navTap(v) {
				if (v === this.navIdx) return;
				this.navIdx = v;
				this.page = 0;
				this.list = [];
				this.getList();
			},
			openAddres(v) {
				uni.openLocation({
					latitude: parseFloat(v.lat),
					longitude: parseFloat(v.lng),
					address: v.address,
					scale: 7
				})
			},
			phoneCall(v) {
				uni.makePhoneCall({
					phoneNumber: v
				})
			},
			preImage(v) {
				uni.previewImage({
					urls: [v]
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "/store/icon.css";

	page {
		background: #f2f2f2;
		color: #303133;
	}

	.wp {
		letter-spacing: 1px;
	}

	.p_head {
		background: #fff;
		position: fixed;
		top: 0;
		width: 100%;
		z-index: 100;

		.shop_info_swiper {
			height: 285upx;

			.shop_info {
				background: rgb(65, 4, 108);
				color: #fff;
				font-size: 30upx;
				padding: 20upx;

				.list_li {
					display: flex;
					align-items: center;
					justify-content: space-between;
					line-height: 45upx;

					.name {
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						padding-right: 20upx;
						width: calc(100% - 200upx);
					}

					.label {
						border: 1px #fff solid;
						border-radius: 15upx;
						color: #fff;
						text-align: center;
						width: 200upx;
					}

					.text_line {
						text-decoration: underline;
					}

					.receive {
						background: rgb(255, 255, 0);
						border-radius: 10upx;
						color: #000;
						text-align: center;
						line-height: 65upx;
						width: 200upx;
					}
				}

				.list_li1 {
					align-items: flex-end;
					line-height: 65upx;
				}
			}
		}



		.nav_bar {
			color: #000;
			display: flex;
			align-items: center;

			text {
				flex: 1;
				font-size: 30upx;
				line-height: 90upx;
				text-align: center;
				position: relative;
			}

			.active::after {
				border-bottom: 2px $bg-color solid;
				content: '';
				position: absolute;
				bottom: 4px;
				left: 40%;
				transform: translateX(-50%);
				width: 50upx;
			}
		}
	}

	.p_body {
		padding: 375upx 20upx 100upx;
		overflow: hidden;

		.list_item {
			background: #fff;
			border-radius: 20upx;
			color: #303133;
			margin-top: 30upx;
			padding: 20upx;

			.title {
				border-bottom: 1px #DCDFE6 solid;
				display: flex;
				align-items: center;
				font-size: 32upx;
				font-weight: bold;
				margin-bottom: 20upx;
				padding-bottom: 20upx;

				.name {
					color: rgb(10, 19, 141);
					overflow: hidden;
					flex: 1;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.label {
					color: $bg-color;
					text-align: right;
					width: 155upx;
				}
			}

			.list_li,
			.left {
				display: flex;
				align-items: center;
				justify-content: space-between;
				line-height: 55upx;

				.left {
					justify-content: flex-start;
					color: #303133;
				}
			}

			.color_1 {
				color: #927419;
			}

			.warn {
				background: #f2f2f2;
				border-radius: 10upx;
				color: #999;
				font-size: 26upx;
				line-height: 35upx;
				margin: 10upx 0 20upx;
				padding: 10upx;
			}

			.buttons {
				display: flex;
				align-items: center;
				justify-content: space-evenly;
				button{
					width: 22%;
					padding: 0;
					color: #fff;
				}
				.button_1 {
					background: rgb(151, 1, 1);
				}
				.button_2 {
					background: rgb(9, 72, 1);
				}
				.button_3 {
					background: #50b544;
				}
				.button_4 {
					background: #d8d33b;
				}
			}
		}
	}

	.input {
		display: flex;
		align-items: center;
		flex: 1;
	}

	.uni-easyinput .uni-easyinput__content-input {
		text-align: right;
		padding-right: 0 !important;
	}

	.empty {
		image {
			height: 60upx;
			width: 60upx;
		}

		text-align: center;
		color: #4399fc;
		padding-top: 30upx;
	}
</style>